package threads;

import messages.GenericMessage;
import connection.TCPSecureServerSocket;
import connection.exception.ConnectionResetException;

public class CertcopWebConnectionThread extends Thread{
	
	private TCPSecureServerSocket _tcpSocket;
	
	public CertcopWebConnectionThread(TCPSecureServerSocket socket){
		_tcpSocket = socket;
	}

	
	public void run(){
		try {
			_tcpSocket.isVericop(false);
			_tcpSocket.waitChannelEstablishmentMode();
			
			while(_tcpSocket.isSecureChannelEstablished()){
				GenericMessage genMessage = new GenericMessage();
                genMessage._number = 1000;
                genMessage._objectString = "gafafadfa";
                genMessage._objectType = "gfafgafwgedrfgrdgnrhw";
                genMessage._signature = "aggggggaaagggagag";

                _tcpSocket.send(genMessage);
                //GenericMessage genMessage = (GenericMessage)_tcpSocket.receive();
				
				genMessage._number = 013431314;
				
				_tcpSocket.send(genMessage);
			}
			
		} catch (ConnectionResetException e) {
			e.printStackTrace();
		}
		
		
	}
}
